The majority of applications, which allocate memory in their application heap zone only, do not need to use any of the routines in this section. The few applications that do allocate memory in zones other than the application heap zone can use the GetZone function and the SetZone procedure to get and set the current zone, the ApplicationZone and SystemZone functions to obtain pointers to the application and system zones, and the HandleZone and PtrZone functions to find the zones in which relocatable and nonrelocatable blocks lie.
To find which zone is current, use the GetZone function.
FUNCTION GetZone: THz;
To change the current heap zone, you can use the SetZone procedure.
PROCEDURE SetZone (hz: THz);
The SetZone procedure makes the zone to which hz points the current heap zone. Often, you use the SetZone procedure in conjunction with one of the ApplicationZone , SystemZone , HandleZone , and PtrZone functions. For example, the code SetZone(SystemZone) makes the system heap zone current.
To obtain a pointer to the application heap zone, you can use the ApplicationZone function.
FUNCTION ApplicationZone: THz;
To obtain a pointer to the system heap zone, you can use the SystemZone function.
FUNCTION SystemZone: THz;
If you need to know which heap zone contains a particular relocatable block, you can use the HandleZone function.
FUNCTION HandleZone (h: Handle): THz;
The HandleZone function returns a pointer to the heap zone containing the relocatable block whose handle is h . In case of an error, the result returned by HandleZone is undefined and should be ignored.
If the handle h is empty (that is, if it points to a NIL master pointer), HandleZone returns a pointer to the heap zone that contains the master pointer.<36pt>
If you have allocated a nonrelocatable block and need to know in which zone it lies, you can use the PtrZone function.
FUNCTION PtrZone (p: Ptr): THz;
The PtrZone function returns a pointer to the heap zone containing the nonrelocatable block pointed to by p .
In case of an error, the result returned by PtrZone is undefined and should be ignored.